Skip to content

Conversation

@hykim02
Copy link
Collaborator

@hykim02 hykim02 commented May 7, 2025

Summary by CodeRabbit

  • Refactor

    • Unified and simplified service, controller, and repository class names by removing version suffixes.
    • Updated package structures and imports to use non-versioned classes throughout the application.
    • Renamed related test classes and updated their dependencies accordingly.
  • Tests

    • Adjusted all test files to reference the updated class and package names, ensuring consistency with the main application code.

@coderabbitai
Copy link

coderabbitai bot commented May 7, 2025

Walkthrough

This change removes all "V2" (version 2) controller, service, and repository classes, reverting the codebase to use the original, non-versioned components throughout the main and test code. All relevant package declarations, imports, class names, and field types have been updated accordingly to reference the non-V2 versions.

Changes

Files/Groups Change Summary
src/main/java/com/example/Jinus/controller/*.java Controllers renamed from *V2 to original names; package changed from .controller.v2 to .controller.
src/main/java/com/example/Jinus/repository/cafeteria/*.java
src/main/java/com/example/Jinus/repository/notice/*.java
src/main/java/com/example/Jinus/repository/userInfo/*.java
Repository interfaces renamed from *V2 to original names; packages updated to remove .v2.
src/main/java/com/example/Jinus/service/cafeteria/*.java
src/main/java/com/example/Jinus/service/diet/*.java
src/main/java/com/example/Jinus/service/notice/*.java
src/main/java/com/example/Jinus/service/userInfo/*.java
Service classes renamed from *V2 to original names; package and dependency types updated to non-V2 versions.
src/test/java/com/example/Jinus/controller/CafeteriaControllerTest.java
src/test/java/com/example/Jinus/repository/cafeteria/*.java
src/test/java/com/example/Jinus/repository/notice/*.java
src/test/java/com/example/Jinus/repository/userInfo/*.java
src/test/java/com/example/Jinus/service/cafeteria/*.java
src/test/java/com/example/Jinus/service/notice/*.java
src/test/java/com/example/Jinus/service/userInfo/*.java
Test classes and fields renamed from *V2 to original names; imports and annotations updated to match.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant Service
    participant Repository

    Client->>Controller: Sends Request
    Controller->>Service: Delegates business logic
    Service->>Repository: Fetches or updates data
    Repository-->>Service: Returns data/result
    Service-->>Controller: Returns processed data
    Controller-->>Client: Returns response
Loading

Poem

A hop, a skip, a version gone,
The V2s packed their bags and moved on.
Now simpler names, less to confuse,
The codebase shines with lighter hues.
Old and new, now unified,
The rabbit leaps with coder’s pride!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 22

🔭 Outside diff range comments (23)
src/main/java/com/example/Jinus/service/cafeteria/CafeteriaService.java (3)

22-22: 🛠️ Refactor suggestion

Update field reference

Update this reference to the renamed field.

-            return campusResponseServiceV2.makeCampusListCard();
+            return campusResponseService.makeCampusListCard();

28-28: 🛠️ Refactor suggestion

Update field reference

Update this reference to the renamed field.

-                : campusResponseServiceV2.makeCampusListCard(); // 존재 X -> 캠퍼스 정보 반환
+                : campusResponseService.makeCampusListCard(); // 존재 X -> 캠퍼스 정보 반환

33-35: 🛠️ Refactor suggestion

Update all field references

Update these references to the renamed fields.

-        String campusName = campusServiceV2.getUserCampusName(campusId);
-        List<CafeteriaDto> cafeteriaList = cacheServiceV2.getCafeteriaList(campusId);
-        return cafeteriaResponseServiceV2.createCafeteriaListCard(campusName, cafeteriaList);
+        String campusName = campusService.getUserCampusName(campusId);
+        List<CafeteriaDto> cafeteriaList = cacheService.getCafeteriaList(campusId);
+        return cafeteriaResponseService.createCafeteriaListCard(campusName, cafeteriaList);
src/test/java/com/example/Jinus/service/userInfo/UserServiceTest.java (4)

32-33: 🛠️ Refactor suggestion

Update field references after renaming

After updating the field names, you'll need to update this reference as well.

-        Mockito.when(userRepositoryV2.findCampusIdById(kakaoId)).thenReturn(Optional.of(campusId)); // Mocking
-        int result = userServiceV2.getUserCampusId(kakaoId);
+        Mockito.when(userRepository.findCampusIdById(kakaoId)).thenReturn(Optional.of(campusId)); // Mocking
+        int result = userService.getUserCampusId(kakaoId);

46-47: 🛠️ Refactor suggestion

Update field references after renaming

After updating the field names, you'll need to update this reference as well.

-        Mockito.when(userRepositoryV2.findCampusIdById(kakaoId)).thenReturn(Optional.empty()); // Mocking
-        int result = userServiceV2.getUserCampusId(kakaoId);
+        Mockito.when(userRepository.findCampusIdById(kakaoId)).thenReturn(Optional.empty()); // Mocking
+        int result = userService.getUserCampusId(kakaoId);

61-62: 🛠️ Refactor suggestion

Update field references after renaming

After updating the field names, you'll need to update this reference as well.

-        Mockito.when(userRepositoryV2.findDepartmentIdById(kakaoId)).thenReturn(Optional.of(departmentId));
-        int result = userServiceV2.getUserDepartmentId(kakaoId);
+        Mockito.when(userRepository.findDepartmentIdById(kakaoId)).thenReturn(Optional.of(departmentId));
+        int result = userService.getUserDepartmentId(kakaoId);

75-76: 🛠️ Refactor suggestion

Update field references after renaming

After updating the field names, you'll need to update this reference as well.

-        Mockito.when(userRepositoryV2.findDepartmentIdById(kakaoId)).thenReturn(Optional.empty());
-        int result = userServiceV2.getUserDepartmentId(kakaoId);
+        Mockito.when(userRepository.findDepartmentIdById(kakaoId)).thenReturn(Optional.empty());
+        int result = userService.getUserDepartmentId(kakaoId);
src/main/java/com/example/Jinus/controller/NoticeController.java (3)

31-31: 🛠️ Refactor suggestion

Update field reference after renaming

After updating the field names, you'll need to update this reference as well.

-        return noticeServiceV2.existUserReturnNotice(departmentEng, departmentId);
+        return noticeService.existUserReturnNotice(departmentEng, departmentId);

39-41: 🛠️ Refactor suggestion

Update field references after renaming

After updating the field names, you'll need to update these references as well.

-        int departmentId = userServiceV2.getUserDepartmentId(userId);
         // 학과 영문명 찾기
-        String departmentEng = departmentServiceV2.getDepartmentEng(departmentId);
+        int departmentId = userService.getUserDepartmentId(userId);
         // 학과 영문명 찾기
+        String departmentEng = departmentService.getDepartmentEng(departmentId);

44-46: 🛠️ Refactor suggestion

Update field references after renaming

After updating the field names, you'll need to update these references as well.

-            return noticeServiceV2.existUserReturnNotice(departmentEng, departmentId);
         } else {
-            return noticeServiceV2.doesNotExistUserReturnBlock();
+            return noticeService.existUserReturnNotice(departmentEng, departmentId);
         } else {
+            return noticeService.doesNotExistUserReturnBlock();
src/main/java/com/example/Jinus/controller/DietController.java (1)

19-19: 🛠️ Refactor suggestion

Update field reference after renaming

After updating the field name, you'll need to update this reference as well.

-        return dietServiceV2.requestHandler(requestDto);
+        return dietService.requestHandler(requestDto);
src/test/java/com/example/Jinus/service/cafeteria/CampusServiceTest.java (2)

34-35: 🛠️ Refactor suggestion

Update variable references to match renamed fields

These references need to be updated to match the renamed fields without the V2 suffix.

    // when
-    Mockito.when(campusRepositoryV2.findCampusNameByCampusId(campusId)).thenReturn(campusName); // Mocking
-    String result = campusServiceV2.getUserCampusName(campusId);
+    Mockito.when(campusRepository.findCampusNameByCampusId(campusId)).thenReturn(campusName); // Mocking
+    String result = campusService.getUserCampusName(campusId);

50-51: 🛠️ Refactor suggestion

Update variable references to match renamed fields

These references need to be updated to match the renamed fields without the V2 suffix.

    // when
-    Mockito.when(campusRepositoryV2.findCampusList()).thenReturn(campusList);
-    List<CampusEntity> result = campusServiceV2.getCampusList();
+    Mockito.when(campusRepository.findCampusList()).thenReturn(campusList);
+    List<CampusEntity> result = campusService.getCampusList();
src/test/java/com/example/Jinus/service/userInfo/DepartmentServiceTest.java (1)

29-30: 🛠️ Refactor suggestion

Update variable references to match renamed fields

These references need to be updated to match the renamed fields without the V2 suffix.

    // when
-    Mockito.when(departmentRepositoryV2.findDepartmentEngById(id)).thenReturn(eng);
-    String result = departmentServiceV2.getDepartmentEng(id);
+    Mockito.when(departmentRepository.findDepartmentEngById(id)).thenReturn(eng);
+    String result = departmentService.getDepartmentEng(id);
src/main/java/com/example/Jinus/service/cafeteria/CafeteriaQueryService.java (2)

20-22: 🛠️ Refactor suggestion

Update repository reference to match renamed field

This reference needs to be updated to match the renamed repository field without the V2 suffix.

public int getCafeteriaId(String cafeteriaName, int campusId) {
-    return cafeteriaRepositoryV2.findCafeteriaId(cafeteriaName, campusId).orElse(-1);
+    return cafeteriaRepository.findCafeteriaId(cafeteriaName, campusId).orElse(-1);
}

28-30: 🛠️ Refactor suggestion

Update repository reference to match renamed field

This reference needs to be updated to match the renamed repository field without the V2 suffix.

public String getImgUrl(int cafeteriaId) {
-    return cafeteriaRepositoryV2.findImgUrlByCafeteriaId(cafeteriaId);
+    return cafeteriaRepository.findImgUrlByCafeteriaId(cafeteriaId);
}
src/test/java/com/example/Jinus/service/cafeteria/CafeteriaServiceTest.java (1)

38-39: 🛠️ Refactor suggestion

Update variable references to match renamed fields

These references need to be updated to match the renamed fields without the V2 suffix.

    // when
-    Mockito.when(cafeteriaRepositoryV2.findCafeteriaListByCampusId(campusId)).thenReturn(resultList);
-    List<CafeteriaDto> result = cacheServiceV2.getCafeteriaList(campusId);
+    Mockito.when(cafeteriaRepository.findCafeteriaListByCampusId(campusId)).thenReturn(resultList);
+    List<CafeteriaDto> result = cacheService.getCafeteriaList(campusId);
src/main/java/com/example/Jinus/service/cafeteria/CacheService.java (2)

27-41: 🛠️ Refactor suggestion

Method still references v2-named variables

This method references dietRepositoryV2 which should be updated to match the non-V2 naming scheme.

public List<DietDto> getDietList(HandleRequestDto parameters, int cafeteriaId) {
    String key = parameters.getDietDate() + "::" + parameters.getPeriod() + "::" + cafeteriaId;

    List<DietDto> cached = (List<DietDto>) redisConfig.redisTemplate().opsForValue().get(key);
    if (cached != null) return cached;

-    List<DietDto> result = dietRepositoryV2.findDietList(parameters.getDietDate(), parameters.getPeriod(), cafeteriaId);
+    List<DietDto> result = dietRepository.findDietList(parameters.getDietDate(), parameters.getPeriod(), cafeteriaId);

    if (result != null && !result.isEmpty()) {
        long ttlSeconds = calculateTtlUntilNextMidnight(parameters.getDietDate());
        redisConfig.redisTemplate().opsForValue().set(key, result, Duration.ofSeconds(ttlSeconds));
    }

    return result;
}

56-64: 🛠️ Refactor suggestion

Cafeteria list method still references v2-named variable

The getCafeteriaList method refers to cafeteriaRepositoryV2 which should be updated to match the non-V2 naming convention.

@Cacheable(
        value = "cafeteriaList",
        key = "#p0",
        cacheManager = "contentCacheManager")
public List<CafeteriaDto> getCafeteriaList(int campusId) {
-    return cafeteriaRepositoryV2.findCafeteriaListByCampusId(campusId);
+    return cafeteriaRepository.findCafeteriaListByCampusId(campusId);
}
src/main/java/com/example/Jinus/service/diet/DietQueryService.java (1)

28-28: 🛠️ Refactor suggestion

Method still references v2-named variable

This method references cacheServiceV2 which should be updated to match the non-V2 naming scheme.

-        List<DietDto> dietDtos = cacheServiceV2.getDietList(parameters, cafeteriaId);
+        List<DietDto> dietDtos = cacheService.getDietList(parameters, cafeteriaId);
src/main/java/com/example/Jinus/service/diet/DietParameterService.java (2)

53-53: 🛠️ Refactor suggestion

Method still references v2-named variable

This method references userServiceV2 which should be updated to match the non-V2 naming scheme.

-        int campusId = userServiceV2.getUserCampusId(kakaoId);
+        int campusId = userService.getUserCampusId(kakaoId);

56-56: 🛠️ Refactor suggestion

Method still references v2-named variable

This method references campusServiceV2 which should be updated to match the non-V2 naming scheme.

-            return campusServiceV2.getUserCampusName(campusId);
+            return campusService.getUserCampusName(campusId);
src/main/java/com/example/Jinus/service/diet/DietService.java (1)

34-34: 🛠️ Refactor suggestion

Update all service variable references throughout the methods.

In addition to updating the field declarations, you'll need to update all references to these variables throughout the class methods. Here are some examples:

- HandleRequestDto parameters = dietParameterServiceV2.setParameters(kakaoId, time, requestDto);
+ HandleRequestDto parameters = dietParameterService.setParameters(kakaoId, time, requestDto);

- int campusId = campusServiceV2.getCampusId(parameters.getCampusName());
- int cafeteriaId = cafeteriaQueryServiceV2.getCafeteriaId(parameters.getCafeteriaName(), campusId);
+ int campusId = campusService.getCampusId(parameters.getCampusName());
+ int cafeteriaId = cafeteriaQueryService.getCafeteriaId(parameters.getCafeteriaName(), campusId);

- return dietResponseServiceV2.errorMsgThereIsNoCafeteria();
+ return dietResponseService.errorMsgThereIsNoCafeteria();

- String diets = dietQueryServiceV2.getDietResponse(parameters, cafeteriaId);
+ String diets = dietQueryService.getDietResponse(parameters, cafeteriaId);

- String imgUrl = cafeteriaQueryServiceV2.getImgUrl(cafeteriaId);
+ String imgUrl = cafeteriaQueryService.getImgUrl(cafeteriaId);

- return dietResponseServiceV2.mappingResponse(parameters, imgUrl, title, description);
+ return dietResponseService.mappingResponse(parameters, imgUrl, title, description);

Consider using your IDE's refactoring tools to ensure all references are updated consistently.

Also applies to: 41-42, 46-46, 49-49, 57-57, 72-72

🧹 Nitpick comments (2)
src/test/java/com/example/Jinus/repository/cafeteria/CampusRepositoryTest.java (1)

27-27: Consider updating the field name for consistency.

While the repository type has been updated to CampusRepository, the field name campusRepositoryV2 still contains the V2 suffix. Consider renaming the field to campusRepository for consistency with the type name.

-    private CampusRepository campusRepositoryV2;
+    private CampusRepository campusRepository;

This would require updating all references to this field throughout the test class (lines 31, 32, 33, 44, 60).

src/test/java/com/example/Jinus/repository/userInfo/DepartmentRepostoryTest.java (1)

19-19: Fix typo in class name

There's a typo in the class name: "Repostory" instead of "Repository". This should be corrected for consistency and proper naming.

-public class DepartmentRepostoryTest {
+public class DepartmentRepositoryTest {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b81ed8f and c1f0134.

📒 Files selected for processing (38)
  • src/main/java/com/example/Jinus/controller/CafeteriaController.java (2 hunks)
  • src/main/java/com/example/Jinus/controller/DietController.java (2 hunks)
  • src/main/java/com/example/Jinus/controller/NoticeController.java (2 hunks)
  • src/main/java/com/example/Jinus/repository/cafeteria/CafeteriaRepository.java (1 hunks)
  • src/main/java/com/example/Jinus/repository/cafeteria/CampusRepository.java (2 hunks)
  • src/main/java/com/example/Jinus/repository/cafeteria/DietRepository.java (2 hunks)
  • src/main/java/com/example/Jinus/repository/notice/CategoryRepository.java (2 hunks)
  • src/main/java/com/example/Jinus/repository/notice/NoticeRepository.java (2 hunks)
  • src/main/java/com/example/Jinus/repository/userInfo/DepartmentRepository.java (2 hunks)
  • src/main/java/com/example/Jinus/repository/userInfo/UserRepository.java (2 hunks)
  • src/main/java/com/example/Jinus/service/cafeteria/CacheService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/cafeteria/CafeteriaQueryService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/cafeteria/CafeteriaResponseService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/cafeteria/CafeteriaService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/cafeteria/CampusResponseService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/cafeteria/CampusService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/diet/DietParameterService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/diet/DietQueryService.java (1 hunks)
  • src/main/java/com/example/Jinus/service/diet/DietResponseService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/diet/DietService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/notice/CategoryService.java (1 hunks)
  • src/main/java/com/example/Jinus/service/notice/NoticeService.java (2 hunks)
  • src/main/java/com/example/Jinus/service/userInfo/DepartmentService.java (1 hunks)
  • src/main/java/com/example/Jinus/service/userInfo/UserService.java (2 hunks)
  • src/test/java/com/example/Jinus/controller/CafeteriaControllerTest.java (1 hunks)
  • src/test/java/com/example/Jinus/repository/cafeteria/CafeteriaRepositoryTest.java (1 hunks)
  • src/test/java/com/example/Jinus/repository/cafeteria/CampusRepositoryTest.java (1 hunks)
  • src/test/java/com/example/Jinus/repository/notice/NoticeCategoryRepositoryTest.java (1 hunks)
  • src/test/java/com/example/Jinus/repository/notice/NoticeRepositoryTest.java (1 hunks)
  • src/test/java/com/example/Jinus/repository/userInfo/DepartmentRepostoryTest.java (1 hunks)
  • src/test/java/com/example/Jinus/repository/userInfo/UserRepositoryTest.java (2 hunks)
  • src/test/java/com/example/Jinus/service/cafeteria/CafeteriaServiceTest.java (1 hunks)
  • src/test/java/com/example/Jinus/service/cafeteria/CampusServiceTest.java (2 hunks)
  • src/test/java/com/example/Jinus/service/notice/CategoryServiceTest.java (2 hunks)
  • src/test/java/com/example/Jinus/service/notice/NoticeServiceTest.java (2 hunks)
  • src/test/java/com/example/Jinus/service/userInfo/DepartmentServiceTest.java (2 hunks)
  • src/test/java/com/example/Jinus/service/userInfo/UserServiceHikariCPTest.java (1 hunks)
  • src/test/java/com/example/Jinus/service/userInfo/UserServiceTest.java (2 hunks)
🔇 Additional comments (25)
src/main/java/com/example/Jinus/repository/userInfo/UserRepository.java (1)

1-12: Successful interface rename and package migration.

The change from UserRepositoryV2 to UserRepository and the corresponding package update is consistent with the PR's goal of removing V2 class naming.

src/main/java/com/example/Jinus/repository/userInfo/DepartmentRepository.java (1)

1-10: Interface rename and package change implemented correctly.

The change from DepartmentRepositoryV2 to DepartmentRepository and the corresponding package update aligns with the PR's overall V2 naming removal strategy.

src/test/java/com/example/Jinus/service/userInfo/UserServiceHikariCPTest.java (1)

23-23: Service dependency type updated correctly.

The service reference has been properly updated from UserServiceV2 to UserService, which is consistent with the V2 naming removal.

src/test/java/com/example/Jinus/repository/cafeteria/CampusRepositoryTest.java (1)

24-24: Test class renamed successfully.

The test class name has been properly updated from CampusRepositoryV2Test to CampusRepositoryTest.

src/main/java/com/example/Jinus/service/cafeteria/CafeteriaResponseService.java (1)

1-1: Class and package successfully renamed.

The class has been properly renamed from CafeteriaResponseServiceV2 to CafeteriaResponseService and moved from the v2 package structure to the standard package hierarchy, which aligns with the PR objective of removing V2 suffixes from class names.

Also applies to: 19-19

src/main/java/com/example/Jinus/repository/notice/NoticeRepository.java (2)

1-1: Interface successfully renamed and relocated.

The interface has been properly renamed from NoticeRepositoryV2 to NoticeRepository and moved from the v2 package structure to the standard package hierarchy, which aligns with the PR objective.

Also applies to: 10-10


11-13: Verify JPQL query compatibility.

The query includes a LIMIT 4 clause which may not be standard JPQL syntax (it's typically SQL-specific). This could cause issues depending on your JPA implementation and database.

Consider using Spring Data's pagination features instead:

-    @Query("SELECT n FROM NoticeEntity n WHERE n.categoryId = :categoryId " +
-            "ORDER BY n.createdAt DESC LIMIT 4")
-    List<NoticeEntity> findNoticeListByCategoryId(@Param("categoryId")int categoryId);
+    @Query("SELECT n FROM NoticeEntity n WHERE n.categoryId = :categoryId " +
+            "ORDER BY n.createdAt DESC")
+    List<NoticeEntity> findTop4NoticeListByCategoryId(@Param("categoryId") int categoryId, Pageable pageable);

Then use it with:

// In service class
List<NoticeEntity> notices = noticeRepository.findTop4NoticeListByCategoryId(categoryId, 
                                PageRequest.of(0, 4));

Alternatively, you could use the derived method name approach:

List<NoticeEntity> findTop4ByCategoryIdOrderByCreatedAtDesc(int categoryId);
src/main/java/com/example/Jinus/service/diet/DietResponseService.java (1)

1-1: Class renamed and package structure updated.

The class has been properly renamed from DietResponseServiceV2 to DietResponseService. Note that the package has changed from com.example.Jinus.service.v2.cafeteria to com.example.Jinus.service.diet, which reflects both the removal of the v2 segment and an appropriate move from cafeteria to diet package.

Also applies to: 15-15

src/main/java/com/example/Jinus/repository/cafeteria/CampusRepository.java (1)

1-12: Changes look good: Package and interface renaming consistent with PR objectives.

The repository interface has been successfully renamed from CampusRepositoryV2 to CampusRepository and moved from the v2 package hierarchy to the standard repository structure. This aligns with the PR's goal of removing V2 designations from filenames.

src/main/java/com/example/Jinus/repository/notice/CategoryRepository.java (1)

1-10: Proper renaming of repository interface and package.

The interface has been correctly renamed from CategoryRepositoryV2 to CategoryRepository and moved to the appropriate non-versioned package structure. This change maintains consistency with the other repository refactoring.

src/test/java/com/example/Jinus/service/notice/CategoryServiceTest.java (1)

4-24: Test class properly updated to reflect non-versioned components.

The test class has been successfully updated with the correct import for CategoryRepository and renamed from CategoryServiceV2Test to CategoryServiceTest. The mock and inject annotations now properly reference the non-versioned components, ensuring test coverage is maintained during this refactoring.

src/main/java/com/example/Jinus/repository/cafeteria/DietRepository.java (1)

1-14: Repository interface renamed and moved to standard package structure.

The interface has been properly renamed from DietRepositoryV2 to DietRepository and relocated from the versioned package to the standard repository package. This change is consistent with the overall refactoring goal of removing V2 designations from filenames.

src/main/java/com/example/Jinus/repository/cafeteria/CafeteriaRepository.java (1)

1-12: Package and interface name changes look good

The changes removing the "V2" suffix from the interface name and updating the package path are consistent with the PR objectives to revert to non-versioned components.

src/test/java/com/example/Jinus/repository/cafeteria/CafeteriaRepositoryTest.java (1)

25-25: Class name correctly updated to remove 'V2'

The test class name has been appropriately changed from CafeteriaRepositoryV2Test to CafeteriaRepositoryTest to reflect the removal of version suffixes.

src/main/java/com/example/Jinus/service/cafeteria/CampusResponseService.java (2)

1-1: Package updated to remove 'v2' subdirectory

The package declaration has been correctly updated to remove the 'v2' subdirectory.


18-18: Class name correctly updated to remove 'V2'

The service class name has been appropriately changed from CampusResponseServiceV2 to CampusResponseService to match the removal of version suffixes.

src/test/java/com/example/Jinus/repository/notice/NoticeCategoryRepositoryTest.java (2)

24-24: Class name correctly updated to remove 'V2'

The test class name has been properly changed from NoticeCategoryRepositoryV2Test to NoticeCategoryRepositoryTest to align with the removal of version suffixes.


27-27: Repository field type correctly updated

The field type has been correctly updated from CategoryRepositoryV2 to CategoryRepository, while maintaining the same variable name noticeCategoryRepository.

src/main/java/com/example/Jinus/service/userInfo/DepartmentService.java (4)

1-1: Package updated to remove 'v2' subdirectory

The package declaration has been correctly updated to remove the 'v2' subdirectory.


3-3: Import updated to reference non-versioned repository

The import statement has been properly updated to reference the non-versioned DepartmentRepository instead of DepartmentRepositoryV2.


9-9: Class name correctly updated to remove 'V2'

The service class name has been appropriately changed from DepartmentServiceV2 to DepartmentService to match the removal of version suffixes.


11-11: Field type correctly updated

The field type has been properly updated from DepartmentRepositoryV2 to DepartmentRepository, while maintaining a consistent variable name.

src/test/java/com/example/Jinus/controller/CafeteriaControllerTest.java (1)

33-46: Test method needs updating

The test method is incomplete and doesn't make assertions. Make sure to update any references to the V2-suffixed mock variables in the test method's implementation once it's completed.

src/main/java/com/example/Jinus/service/notice/CategoryService.java (1)

12-14: Good job on consistent naming here!

Unlike some of the other files, this service class has consistent naming between the class name and field name. The field noticeCategoryRepository doesn't include any V2 suffix, which is good.

src/main/java/com/example/Jinus/controller/CafeteriaController.java (1)

21-21: Verify if API endpoint should retain "v2" in the path.

While internal class names are being updated to remove "V2" suffixes, I notice the API endpoint still includes "/v2/" in its path. Should this also be updated for consistency, or is this intentional API versioning that should remain as is?

@ActiveProfiles("test") // application-test.properties 적용
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.ANY) // H2 사용
public class UserRepositoryV2Test {
public class UserRepositoryTest {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Variable name inconsistent with interface type.

While the class has been correctly renamed and the field type updated to UserRepository, the variable name userRepositoryV2 still contains the V2 suffix. This creates inconsistency between the type and variable name, which could lead to confusion.

-    private UserRepository userRepositoryV2;
+    private UserRepository userRepository;

Additionally, all references to this variable throughout the test methods will need to be updated.

Also applies to: 31-31


@Autowired
NoticeRepositoryV2 noticeRepositoryV2;
NoticeRepository noticeRepositoryV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update the field name to match naming pattern

While the class name has been updated to remove the "V2" suffix, the field name still contains "V2". For consistency, you should rename the field to match the class name pattern.

-    NoticeRepository noticeRepositoryV2;
+    NoticeRepository noticeRepository;

Make sure to update all references to this field in the test methods below.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
NoticeRepository noticeRepositoryV2;
NoticeRepository noticeRepository;

Comment on lines +13 to +16
private final CampusService campusServiceV2;
private final CampusResponseService campusResponseServiceV2;
private final CacheService cacheServiceV2;
private final CafeteriaResponseService cafeteriaResponseServiceV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update field names to match class naming pattern

While the service types have been updated to remove the "V2" suffix, all field names still contain "V2". For consistency with the class naming changes, you should update all field names to remove the "V2" suffix.

-    private final CampusService campusServiceV2;
-    private final CampusResponseService campusResponseServiceV2;
-    private final CacheService cacheServiceV2;
-    private final CafeteriaResponseService cafeteriaResponseServiceV2;
+    private final CampusService campusService;
+    private final CampusResponseService campusResponseService;
+    private final CacheService cacheService;
+    private final CafeteriaResponseService cafeteriaResponseService;

Don't forget to update all references to these fields throughout the class methods.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private final CampusService campusServiceV2;
private final CampusResponseService campusResponseServiceV2;
private final CacheService cacheServiceV2;
private final CafeteriaResponseService cafeteriaResponseServiceV2;
private final CampusService campusService;
private final CampusResponseService campusResponseService;
private final CacheService cacheService;
private final CafeteriaResponseService cafeteriaResponseService;

}
@Autowired
private CafeteriaRepositoryV2 cafeteriaRepositoryV2;
private CafeteriaRepository cafeteriaRepositoryV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Field type updated but variable name still contains 'V2'

While the type has been correctly updated from CafeteriaRepositoryV2 to CafeteriaRepository, the variable name cafeteriaRepositoryV2 still contains the V2 suffix, which is inconsistent with the class renaming pattern.

-    private CafeteriaRepository cafeteriaRepositoryV2;
+    private CafeteriaRepository cafeteriaRepository;

Additionally, you should update all references to this variable throughout the test class (lines 30, 47, 62).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private CafeteriaRepository cafeteriaRepositoryV2;
private CafeteriaRepository cafeteriaRepository;

public class CampusResponseService {

private final CampusServiceV2 campusServiceV2;
private final CampusService campusServiceV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Field type updated but variable name still contains 'V2'

While the type has been correctly updated from CampusServiceV2 to CampusService, the variable name campusServiceV2 still contains the V2 suffix, which is inconsistent with the naming changes made to the classes.

-    private final CampusService campusServiceV2;
+    private final CampusService campusService;

Additionally, you should update all references to this variable throughout the class (line 24).

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +19 to +22
public class NoticeService {

private final NoticeRepositoryV2 noticeRepositoryV2;
private final CategoryServiceV2 categoryServiceV2;
private final NoticeRepository noticeRepositoryV2;
private final CategoryService categoryServiceV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Variable names should also be updated to remove V2 suffix.

While the class names and import types have been updated to remove the "V2" suffix, the field variable names still contain "V2" (noticeRepositoryV2 and categoryServiceV2). This creates inconsistency in your code.

public class NoticeService {

-    private final NoticeRepository noticeRepositoryV2;
-    private final CategoryService categoryServiceV2;
+    private final NoticeRepository noticeRepository;
+    private final CategoryService categoryService;

After making this change, you'll need to update all references to these variables throughout this class.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public class NoticeService {
private final NoticeRepositoryV2 noticeRepositoryV2;
private final CategoryServiceV2 categoryServiceV2;
private final NoticeRepository noticeRepositoryV2;
private final CategoryService categoryServiceV2;
public class NoticeService {
private final NoticeRepository noticeRepository;
private final CategoryService categoryService;

Comment on lines 24 to +29
@InjectMocks
private NoticeServiceV2 noticeServiceV2;
private NoticeService noticeServiceV2;
@Mock
private CategoryServiceV2 categoryServiceV2;
private CategoryService categoryServiceV2;
@Mock
private NoticeRepositoryV2 noticeRepositoryV2;
private NoticeRepository noticeRepositoryV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Test field names should also be updated to remove V2 suffix.

While the class names and types have been updated to remove "V2", the injected field names still contain "V2" (noticeServiceV2, categoryServiceV2, noticeRepositoryV2). This creates inconsistency between class names and variable names.

@InjectMocks
-private NoticeService noticeServiceV2;
+private NoticeService noticeService;
@Mock
-private CategoryService categoryServiceV2;
+private CategoryService categoryService;
@Mock
-private NoticeRepository noticeRepositoryV2;
+private NoticeRepository noticeRepository;

After making this change, you'll need to update all references to these variables throughout the test class.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@InjectMocks
private NoticeServiceV2 noticeServiceV2;
private NoticeService noticeServiceV2;
@Mock
private CategoryServiceV2 categoryServiceV2;
private CategoryService categoryServiceV2;
@Mock
private NoticeRepositoryV2 noticeRepositoryV2;
private NoticeRepository noticeRepositoryV2;
@InjectMocks
private NoticeService noticeService;
@Mock
private CategoryService categoryService;
@Mock
private NoticeRepository noticeRepository;

public class UserService {

private final UserRepositoryV2 userRepositoryV2;
private final UserRepository userRepositoryV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Variable name should be updated to remove V2 suffix.

While the class names and import types have been updated to remove the "V2" suffix, the field variable name still contains "V2" (userRepositoryV2). This creates inconsistency in your code.

-private final UserRepository userRepositoryV2;
+private final UserRepository userRepository;

After making this change, you'll need to update all references to this variable in the methods below.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private final UserRepository userRepositoryV2;
private final UserRepository userRepository;

Comment on lines +17 to +18
private final UserService userServiceV2;
private final CafeteriaService cafeteriaServiceV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update variable names to match their types.

The service field types have been updated to remove the V2 suffix, but the variable names still contain "V2" (userServiceV2 and cafeteriaServiceV2). For better consistency and readability, consider updating the variable names as well:

-    private final UserService userServiceV2;
-    private final CafeteriaService cafeteriaServiceV2;
+    private final UserService userService;
+    private final CafeteriaService cafeteriaService;

Don't forget to update all references to these variables throughout the class.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private final UserService userServiceV2;
private final CafeteriaService cafeteriaServiceV2;
private final UserService userService;
private final CafeteriaService cafeteriaService;

Comment on lines +22 to +26
private final CampusService campusServiceV2;
private final CafeteriaQueryService cafeteriaQueryServiceV2;
private final DietParameterService dietParameterServiceV2;
private final DietResponseService dietResponseServiceV2;
private final DietQueryService dietQueryServiceV2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Update service variable names to match their types.

The service field types have been updated to remove the V2 suffix, but the variable names still contain "V2". For consistency and readability, consider updating the variable names:

-    private final CampusService campusServiceV2;
-    private final CafeteriaQueryService cafeteriaQueryServiceV2;
-    private final DietParameterService dietParameterServiceV2;
-    private final DietResponseService dietResponseServiceV2;
-    private final DietQueryService dietQueryServiceV2;
+    private final CampusService campusService;
+    private final CafeteriaQueryService cafeteriaQueryService;
+    private final DietParameterService dietParameterService;
+    private final DietResponseService dietResponseService;
+    private final DietQueryService dietQueryService;

Remember to update all references to these variables throughout the class methods as well.

@hykim02 hykim02 merged commit d2619a3 into GNU-connect:main May 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant